<?php

/**
 * @version		$Id: view.html.php 15 2009-11-02 18:37:15Z chdemko $
 * @package		Joomla16.Tutorials
 * @subpackage	Components
 * @copyright	Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
 * @author		Christophe Demko
 * @link		http://joomlacode.org/gf/project/helloworld_1_6/
 * @license		License GNU General Public License version 2 or later
 */

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

// import Joomla view library
jimport('joomla.application.component.view');

/**
 * HTML View class for the HelloWorld Component
 */
class bgViewbg extends JView
{
	// Overwriting JView display method
	function display($tpl = null) 
	{   
	    
        $model = $this->getModel();
        
    	JToolBarHelper::title( '送信先選択' );

        switch(JRequest::getVar('task','hienpopup')){
            case 'hienpopup':
                $this->setLayout('hienpopup');
                break;
            
            
            case 'popup':
                $usertype = $model->getAllUsertype();
                $mailgroup = $model->getAllMailGroup();
                $area = $model->getAllArea();
                $area_code = 0;
                $pref = $model->getAllPrefOfArea($area_code);
                
                $this->assignRef('usertype',$usertype);
                $this->assignRef('mailgroup',$mailgroup);
                $this->assignRef('area',$area);
                $this->assignRef('pref',$pref);
                $this->setLayout('c00911');
                
                break;	
                  
            case 'popup_frmessage':
                $usertype = $model->getAllUsertype();
                $mailgroup = $model->getAllMailGroup();
                $area = $model->getAllArea();
                $area_code = 0;
                $pref = $model->getAllPrefOfArea($area_code);
                
                $this->assignRef('usertype',$usertype);
                $this->assignRef('mailgroup',$mailgroup);
                $this->assignRef('area',$area);
                $this->assignRef('pref',$pref);
                
                $this->setLayout('popup_frmessage');
                break;  
                
            default :

		}
        /*
        $app = &JFactory::getApplication();
        $app->close();*/
		parent::display();
	}
    
    function getList($usertype_search,$mailgroup_search,$area_search,$pref_search,$ocba_name){
        $mainframe = JFactory::getApplication();      
        $filter['ocba_name'] = $ocba_name;
        $filter['usertype_search'] = $usertype_search;
        $filter['mailgroup_search'] = $mailgroup_search;
        $filter['area_search'] = $area_search;
        $filter['pref_search'] = $pref_search;
        $model = $this->getModel();
        $lstuser = $model->getAllUserMail($filter);
        $this->rows = $lstuser;        
        return $lstuser;
    }
}




